# authentication/urls.py

from django.urls import path, include
from rest_framework.routers import DefaultRouter
from django.conf.urls.static import static
from django.conf import settings
from .views import (
    CategoryViewSet, ChoicesView, CulturalRelicDetailView, CulturalRelicListView,  CulturalRelicUploadView, DiseaseImageDeleteView, FileDownloadView, ImageDownloadView, PointCloudAPI, RefreshTokenAPI, RegisterAPI, LoginAPI, UserAPI, UserViewSet,  ChangePasswordAPI, VerifyTokenView, compare_disease_images,
)

router = DefaultRouter()
router.register(r'users', UserViewSet)
router.register(r'categories', CategoryViewSet)  # 类别管理API
urlpatterns = [
    # path('register/', RegisterAPI.as_view(), name='register'),
    path('login/', LoginAPI.as_view(), name='login'),
    # path('user/', UserAPI.as_view(), name='user'),
    # path('change-password/', ChangePasswordAPI.as_view(), name='change-password'),
    path('refresh/', RefreshTokenAPI.as_view(), name='refreshToken'),
    # path('verify/', VerifyTokenView.as_view(), name='protected_endpoint'),
    path('choices/', ChoicesView.as_view(), name='choices'),
    # path('surveys/', SurveyUploadView.as_view(), name='survey-upload'),
    path('surveys/', CulturalRelicUploadView.as_view(), name='survey-upload'),
    path('cultural-relics/', CulturalRelicListView.as_view(), name='cultural-relic-list'),
    path('cultural-relics/<int:pk>/', CulturalRelicDetailView.as_view(), name='cultural-relic-detail'),
    path('download/<str:file_type>/<int:pk>/', FileDownloadView.as_view(), name='file-download'),
    # 新增图片下载路由
    path('cultural-relics/<int:pk>/download-image/<str:file_type>/', ImageDownloadView.as_view(), name='download-image'),
    path('cultural-relics/<int:pk>/download-image/<str:file_type>/<int:image_id>/', ImageDownloadView.as_view(), name='download-image-with-id'),
    path('cultural-relics/<int:pk>/delete-image/disease_image/<int:image_id>/', 
         DiseaseImageDeleteView.as_view(), 
         name='delete-disease-image'),  
    path('', include(router.urls)),  # 此时router的路径会被拼接为/api/categories/
    path('relics/<int:relic_id>/point-cloud/', PointCloudAPI.as_view(), name='relic-point-cloud'),
    path('compare_disease_images/', compare_disease_images, name='compare_disease_images'),


]
